package com.shr.test;

import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Scanner;
import java.util.concurrent.LinkedBlockingDeque;
import java.util.concurrent.LinkedBlockingQueue;

public class Main {
	private static final int CUSTOMS_LIMIT_MONEY_PER_BOX = 2000;

	static BoxTemplate boxTemplate = new BoxTemplate() ;
	static Model[] items;
	static int boxMinNum ;
	
	/** 请完成下面这个process函数，实现题目要求的功能 **/
	/** 当然，你也可以不按照这个模板来作答，完全按照自己的想法来 ^-^ **/
	private static int process() {
		return 0 ;
	}

	public void addOne(final BoxTemplate b){
		b.height++;
	}
	
	public static void main(String args[]) {
		Scanner scanner = new Scanner(System.in);
		boxTemplate.price = CUSTOMS_LIMIT_MONEY_PER_BOX;

		while (scanner.hasNext()) {
			boxTemplate.length = scanner.nextInt();
			boxTemplate.width = scanner.nextInt();
			boxTemplate.height = scanner.nextInt();

			int itemNum = scanner.nextInt();
			items = new Model[itemNum];
			for (int i = 0; i < itemNum; i++) {
				Model item = new Model();
				item.price = scanner.nextInt();
				item.length = scanner.nextInt();
				item.width = scanner.nextInt();
				item.height = scanner.nextInt();
				items[i] = item;
			}
			long startTime = System.currentTimeMillis();
			boxMinNum = Integer.MAX_VALUE;
			System.out.println(process());

		}
	}

}

class BoxTemplate{
	int length;
	int width;
	int height;
	int price;
}

class Model{
	int length;
	int width;
	int height;
	int price;
}